//router.js
import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router';

//2. 定义路由组件
import Home from "@/components/pages/Home.vue"

//3.定义路由- 配置路由走向
const routes = [
    {
        path: "/", //页面的路径
        redirect: '/home/register'  //去哪个页面
    },
    {
        path: "/home", //页面的路径
        component: Home,
        children:[
            {
                path:'register',
                component:()=>import("@/components/pages/Register.vue")
            },
            {
                path:'search',
                component:()=>import("@/components/pages/Search.vue")
            }
        ]

    }
];

//4. 创建router实例，然后传“routes”配置
const router = createRouter({
    history: createWebHistory(),
    routes
});

//7.导出router
export default router;